package Lian02;

public class Array {
    public static void main(String[] args) {
        //声明数组
        int[] arrInt;
        //分配空间
        arrInt = new int[10];
        //赋值 下标 从0开始
        arrInt[0] = 1;
        arrInt[1]  = 10;
        arrInt[2] = 100;
        //简写方式
        char[] arrChar = new char[5];
        arrChar[0] = 10;
        arrChar[1] = 55;
        arrChar[2] = 66;

        //一般用循环
        for (int i = 0; i <5 ; i++) {
            arrChar[i] = 2;
        }

        //还有另外两种写法
        //直接声明并赋值
        int[] arrInt1 = {1,21,3};
        System.out.println(arrInt1[1]);

        int[] arrInt2 = new int[]{1,21,3};

    }
}
